<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
  </head>

  <body>
    <div id="app">
      <button @contextmenu.prevent.once="contextMenu">右键点击一下试试</button>
      <div @click.self="outerClick">
        outer

        <div @click.capture="innerClick">
          inner

          <div @click="contentClick">
            content
          </div>
        </div>
      </div>
      <input type="text" @keyup.enter="publish()">
    </div>

    <script>
      Vue.config.productionTip = false;

      const vm = new Vue({
        el: "#app",
        data() {
          return {};
        },
        methods: {
          contextMenu() {
            console.log(1111);
          },
          outerClick() {
            console.log("outer");
          },
          innerClick() {
            console.log("inner");
          },
          contentClick() {
            console.log("content");
          },
          publish(){
            console.log('llll');
          }
        },
      });
    </script>
  </body>
</html>
